/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kohan.battleship;

/**
 *
 * @author STano
 */
public class Board {
    private String[][] board;
    
    public Board() {
        board = new String[10][10];
        for(int i = 0; i <= board.length - 1; i++) {
            for(int j = 0; j < board[0].length; j++) {
                board[i][j] = "-";
            }
        }
    }

    public String[][] getBoard() {
        return board;
    }

    public void setBoard(String[][] board) {
        this.board = board;
    }
  
    public void setFieldBoard(String c, int x, int y) {
        this.board[x][y] = c;
    }
    
    public void  showBoardWithShips() {
        System.out.println("___________________________________\n");
        System.out.println("  0 1 2 3 4 5 6 7 8 9");
        for(int i = 0; i <= board.length - 1; i++) {
            System.out.print(i);
            for(int j = 0; j < board[0].length; j++) {
                System.out.print(" "+board[i][j]);
            }
            System.out.println("");
        }
        System.out.println("___________________________________\n");
    }
    
    public void showBoard() {
        System.out.println("___________________________________\n");
        System.out.println("  0 1 2 3 4 5 6 7 8 9");
        for(int i = 0; i <= board.length - 1; i++) {
            System.out.print(i);
            for(int j = 0; j < board[0].length; j++) {
                if(board[i][j] == "M" || board[i][j] == "-" || board[i][j] == "X") {
                    System.out.print(" "+board[i][j]);
                }
                else {
                    System.out.print(" -");
                }
            }
            System.out.println("");
        }
        System.out.println("___________________________________\n");
    }
}
